home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19960715-19961006 / 000419_news@columbia.edu _Mon Sep 30 07:14:22 1996.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Return-Path: news@columbia.edu
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30]) by watsun.cc.columbia.edu (8.7.5/8.7.3) with ESMTP id HAA22406 for <kermit.misc@watsun.cc.columbia.edu>; Mon, 30 Sep 1996 07:14:21 -0400 (EDT)
  3. Received: (from news@localhost) by newsmaster.cc.columbia.edu (8.7.5/8.7.3) id HAA09501 for kermit.misc@watsun; Mon, 30 Sep 1996 07:14:21 -0400 (EDT)
  4. Path: news.columbia.edu!panix!news1.erols.com!howland.erols.net!newsfeed.internetmci.com!news.stealth.net!solace!eru.mt.luth.se!news.algonet.se!eua.ericsson.se!erinews.ericsson.se!usenet
  5. From: Ulrik Sandberg <lmiusg@lmi.ericsson.se>
  6. Newsgroups: comp.protocols.kermit.misc
  7. Subject: Remote IF EXIST?
  8. Date: Mon, 30 Sep 1996 12:04:05 +0100
  9. Organization: LM Ericsson Ltd, Ireland
  10. Lines: 45
  11. Message-ID: <324FA925.31DFF4F5@lmi.ericsson.se>
  12. NNTP-Posting-Host: eeibhus03.eei.ericsson.se
  13. Mime-Version: 1.0
  14. Content-Type: text/plain; charset=us-ascii
  15. Content-Transfer-Encoding: 7bit
  16. X-Mailer: Mozilla 2.02 (X11; I; SunOS 4.1.4 sun4m)
  17. CC: Ulrik Sandberg <lmiusg@lmi.ericsson.se>
  18.  
  19. Question: Is there a clever way of doing a 'REMOTE IF EXIST <file>'?
  20.  
  21. Background
  22. ----------
  23. (MS Kermit 3.14)
  24. I was recently using the server-capabilities to control a remote
  25. host by starting en external program for creating a file and then
  26. transfer the file to the "client" using the GET command. 
  27.  
  28. At one point I was forced to check if a control file was existing 
  29. on the server before I performed the file transfer (a simple file 
  30. locking protocol). The REMOTE commands do not include a command 
  31. that does that and it was quite frustrating until I found a work-
  32. around (see 'Solution' below).
  33.  
  34. My goal was to either get a result code that could be used in IF 
  35. FAILURE clauses in the script or to redirect the output from a 
  36. REMOTE command to a local file and then perform a local IF EXIST 
  37. on that file.
  38.  
  39. I tried REMOTE DIR <file>, but that was (oddly enough) interpreted 
  40. as REMOTE DIR without a file spec and thus gave me the whole
  41. directory. It seemed like every REMOTE command that took a file 
  42. spec either failed without a result code that could be used in a 
  43. script, or - in the case of redirecting its output - created a 
  44. local file whether the remote file existed or not.
  45.  
  46. Solution
  47. --------
  48. Finally I found out that REMOTE TYPE could be used. The output of
  49. REMOTE TYPE <file> was redirected to a local file (with a unique
  50. name). If the remote file didn't exist, the command failed and no 
  51. output was created. Thus, no local file was created and my local
  52. IF EXIST could be used. If the remote file existed, its contents
  53. was redirected to the temporary local file and IF EXIST could be
  54. used to indicate that the remote file in turn did exist.
  55.  
  56. Comments
  57. --------
  58. This solution assumes that the remote file is rather small, since
  59. its contents has to be transferred. In my case, it was an almost
  60. empty lock file, so it wasn't a problem. 
  61.  
  62. -- 
  63. --Ulrik Sandberg